package com.base.api.controller.broadcast;

import com.base.api.dto.broadcast.BroadcastListDTO;
import com.base.api.service.broadcast.BroadcastApiService;
import com.base.log.WebLog;
import com.base.result.ResponseResult;
import com.base.self.entity.Broadcast;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/api/broadcast")
@Api(tags = "播报")
public class BroadcastApiController {

    private final BroadcastApiService broadcastApiService;

    public BroadcastApiController(BroadcastApiService broadcastApiService) {
        this.broadcastApiService = broadcastApiService;
    }

    @ApiOperation(value="播报查询")
    @PostMapping(value = "/broadcastList", produces = "application/json;charset=UTF-8")
    @ApiResponses({
            @ApiResponse(code = 200, message = "OK", response = Broadcast.class),
    })
    @WebLog
    public ResponseResult broadcastList(@Validated BroadcastListDTO broadcastListDTO){
        return broadcastApiService.broadcastList(broadcastListDTO);
    }
}
